//package com.docjohnson.pamphlet.server;
//
//import org.apache.http.HttpEntity;
//import org.apache.http.HttpResponse;
//import org.apache.http.NameValuePair;
//import org.apache.http.client.HttpClient;
//import org.apache.http.client.entity.UrlEncodedFormEntity;
//import org.apache.http.client.methods.HttpPost;
//import org.apache.http.client.methods.HttpUriRequest;
//import org.apache.http.impl.client.DefaultHttpClient;
//import org.apache.http.message.BasicNameValuePair;
//
//import java.io.InputStream;
//import java.lang.reflect.InvocationTargetException;
//import java.lang.reflect.Method;
//import java.util.ArrayList;
//import java.util.List;
//
//public class PamphletClient {
//
//    public static final int MOBILE = 1;
//    public static final int WEB = 2;
//
//    private static String serviceURL = null;
//    private static int clientType = -1;
//    private static double apiVersion = 1.0;
//
//    private static final String KEY1 = "Key1";
//    private static final String KEY2 = "Key2";
//    private static final String CLIENT_TYPE = "ClientType";
//    private static final String API_VERSION = "APIVersion";
//
//    public static boolean init(final String thisServiceURL) {
//        return init(thisServiceURL, PamphletClient.MOBILE, 1.0);
//    }
//
//    public static boolean init(final String thisServiceURL, final int thisClientType, final double thisAPIVersion) {
//        serviceURL = thisServiceURL;
//        clientType = thisClientType;
//        apiVersion = thisAPIVersion;
//
//        if (!serviceURL.endsWith("/")) serviceURL += "/";
//
//        return true;
//    }
//
//    private static String getResponse(final HttpUriRequest request, final int successCode, final boolean requiresResponse) throws Exception {
//        request.setHeader(CLIENT_TYPE, String.valueOf(PamphletClient.clientType));
//        request.setHeader(API_VERSION, String.valueOf(PamphletClient.apiVersion));
//
//        final HttpClient client = getHttpClient();
//        final HttpResponse response = client.execute(request);
//        final HttpEntity entity = response.getEntity();
//
//        final StringBuilder sb = new StringBuilder();
//        if (entity != null) {
//            final InputStream stream = entity.getContent();
//            byte bytes[] = new byte[4096];
//            int numBytes;
//            while ((numBytes=stream.read(bytes))!=-1) {
//                if (numBytes!=0) {
//                    sb.append(new String(bytes, 0, numBytes));
//                }
//            }
//        }
//
//        if (response.getStatusLine().getStatusCode() != successCode) {
//            closeConnection(client);
//            throw new Exception(sb.toString());
//        }
//
//        closeConnection(client);
//
//        if (!requiresResponse) return null;
//
//        return sb.toString();
//    }
//
//    private static void closeConnection(final HttpClient client) {
//        try {
//            final Method closeMethod = client.getClass().getMethod("close");
//            if (closeMethod != null) {
//                closeMethod.invoke(client);
//            }
//        }
//        catch (IllegalArgumentException ignored) {}
//        catch (IllegalAccessException ignored) {}
//        catch (InvocationTargetException ignored) {}
//        catch (SecurityException ignored) {}
//        catch (NoSuchMethodException ignored) {}
//    }
//
//    private static HttpClient getHttpClient() {
//        Class<?> androidClientClass;
//        try {
//            androidClientClass = Class.forName("android.net.http.AndroidHttpClient");
//            final Method method = androidClientClass.getMethod("newInstance", String.class);
//
//            return (HttpClient) method.invoke(null, "newInstance");
//
//        } catch (ClassNotFoundException ignored) {}
//        catch (IllegalArgumentException ignored) {}
//        catch (IllegalAccessException ignored) {}
//        catch (InvocationTargetException ignored) {}
//        catch (SecurityException ignored) {}
//        catch (NoSuchMethodException ignored) {}
//
//        return new DefaultHttpClient();
//    }
//
//    private static String notInitialized() {
//        return "{ \"errorCode\" : 101 }";
//    }
//
////    /**
////     * Create authentication keys. Created keys are then used for subsequent method calls.
////     *
////     * @param phoneNumber user's phoneNumber
////     * @param password user's password
////     * @return response text
////     * @throws Exception when server response code not ok
////     */
////    public static String login(final String phoneNumber, final String password) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "login");
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("phoneNumber", phoneNumber));
////        postParams.add(new BasicNameValuePair("password", password));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Register user.
////     *
////     * @param phoneNumber
////     * @param password
////     * @param verificationCode
////     * @param timeZone
////     * @return
////     * @throws Exception
////     */
//    public static String getData() throws Exception {
//        if (serviceURL == null) return notInitialized();
//
//        final HttpPost post = new HttpPost(serviceURL);
//
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("phoneNumber", phoneNumber));
////        postParams.add(new BasicNameValuePair("password", password));
////        postParams.add(new BasicNameValuePair("verificationCode", verificationCode));
////        postParams.add(new BasicNameValuePair("timeZone", timeZone));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
//
//        return getResponse(post, 200, true);
//    }
////
////    /**
////     * Activates user account.
////     *
////     * @param activationCode
////     * @return
////     * @throws Exception
////     */
////    public static String activateUser(final String activationCode) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        return getResponse(new HttpGet(serviceURL + "activate/" + URLEncoder.encode(activationCode, "UTF-8")), 200, true);
////    }
////
////    /**
////     * Gets users by phone numbers.
////     *
////     * @param phoneNumbers separated by comma
////     * @return
////     * @throws Exception
////     */
////    public static String getUsersByPhoneNumbers(final String key1, final String key2, final String phoneNumbers) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "user/byPhones");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("phoneNumbers", phoneNumbers));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Gets users by social UIDs.
////     *
////     * @param socialUIDs separated by comma
////     * @param socialNetwork
////     * @return
////     * @throws Exception
////     */
////    public static String getUsersBySocialUIDs(final String key1, final String key2, final String socialUIDs, final String socialNetwork) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "user/bySocialUIDs");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("socialUIDs", socialUIDs));
////        postParams.add(new BasicNameValuePair("socialNetwork", socialNetwork));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Gets user groups.
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String getUserGroups(final String key1, final String key2) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "group/groups");
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Adds group.
////     *
////     * @param groupName
////     * @return
////     * @throws Exception
////     */
////    public static String addGroup(final String key1, final String key2, final String groupName) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "group/add");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("groupName", groupName));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Deletes group by specified id.
////     *
////     * @param groupId
////     * @return
////     * @throws Exception
////     */
////    public static String deleteGroup(final String key1, final String key2, final int groupId) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "group/delete/" + groupId);
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Edits group name.
////     *
////     * @param groupId
////     * @param newName
////     * @return
////     * @throws Exception
////     */
////    public static String editGroupName(final String key1, final String key2, final int groupId, final String newName) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "group/editName/" + groupId + "/" + newName);
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Adds friends to group.
////     *
////     * @param groupId
////     * @param friendId
////     * @return
////     * @throws Exception
////     */
////    public static String addToGroup(final String key1, final String key2, final Integer groupId, final String friendId) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "group/addTo");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("groupId", groupId.toString()));
////        postParams.add(new BasicNameValuePair("friendId", friendId));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Adds a friend to groups.
////     *
////     * @param key1
////     * @param key2
////     * @param friendSuid
////     * @param socialNetwork
////     * @param groupIds
////     * @return
////     * @throws Exception
////     */
////    public static String addFriendToGroups(final String key1, final String key2, final String friendSuid, final String socialNetwork, final String groupIds) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "group/addToGroups");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("friendSuid", friendSuid));
////        postParams.add(new BasicNameValuePair("socialNetwork", socialNetwork));
////        postParams.add(new BasicNameValuePair("groupIds", groupIds));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Removes friends from group.
////     *
////     * @param key1
////     * @param key2
////     * @param groupId
////     * @param friendSuids
////     * @return
////     * @throws Exception
////     */
////    public static String removeFromGroup(final String key1, final String key2, final Integer groupId, final String friendSuids) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "group/removeFrom");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("groupId", groupId.toString()));
////        postParams.add(new BasicNameValuePair("friendId", friendSuids));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Sets user location.
////     *
////     * @param latitude
////     * @param longitude
////     * @param provider
////     * @return
////     * @throws Exception
////     */
////    public static String setLocation(final String key1, final String key2, final Double latitude, final Double longitude, final String provider) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "location/setLoc/");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("latitude", latitude.toString()));
////        postParams.add(new BasicNameValuePair("longitude", longitude.toString()));
////        postParams.add(new BasicNameValuePair("provider", provider));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Adds social account.
////     *
////     * @param socialNetwork
////     * @param socialUid
////     * @param profileImageUrl
////     * @param firstName
////     * @param lastName
////     * @param email
////     * @param screenName
////     * @param atoken
////     * @param asecret
////     * @return
////     * @throws Exception
////     */
////    public static String addSocialAccount(final String key1, final String key2, final String socialNetwork, final String socialUid,
////                                          final String profileImageUrl, final String firstName, final String lastName, final String email,
////                                          final String screenName, final String atoken, final String asecret) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "user/addSocAccount/");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("socialNetwork", socialNetwork));
////        postParams.add(new BasicNameValuePair("socialUid", socialUid));
////        postParams.add(new BasicNameValuePair("profileImageUrl", profileImageUrl));
////        postParams.add(new BasicNameValuePair("firstName", firstName));
////        postParams.add(new BasicNameValuePair("lastName", lastName));
////        postParams.add(new BasicNameValuePair("email", email));
////        postParams.add(new BasicNameValuePair("screenName", screenName));
////        postParams.add(new BasicNameValuePair("atoken", atoken));
////        postParams.add(new BasicNameValuePair("asecret", asecret));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Adds social account.
////     *
////     * @param key_word
////     * @return
////     * @throws Exception
////     */
////    public static String findAccount(final String key1, final String key2, final String key_word) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "user/findAccount/");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("key_word", key_word));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Removes social account by specified socialUid.
////     *
////     * @param socialUid
////     * @param socialNetwork
////     * @return
////     * @throws Exception
////     */
////    public static String removeSocialAccount(final String key1, final String key2, final String socialUid, final String socialNetwork) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "user/removeSocAccount/" + URLEncoder.encode(socialUid, "UTF-8") + "/" + URLEncoder.encode(socialNetwork, "UTF-8"));
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Gets social accounts.
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String getSocialAccounts(final String key1, final String key2) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "user/accounts");
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Gets friends by socialUids.
////     *
////     * @param friendsSUIDs
////     * @return
////     * @throws Exception
////     */
////    public static String getFriendsLocations(final String key1, final String key2, final String friendsSUIDs) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "location/locations");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("friendsSUIDs", friendsSUIDs));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Sends friend request.
////     *
////     * @param key1
////     * @param key2
////     * @param friendUserIds
////     * @return
////     * @throws Exception
////     */
////    public static String sendFriendRequest(final String key1, final String key2, final String friendUserIds) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "friend/sendReq/");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("friendUserIds", friendUserIds));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Updates friend request by setting received status.
////     *
////     * @param friendUserId
////     * @param status
////     * @return
////     * @throws Exception
////     */
////    public static String updateFriendRequest(final String key1, final String key2, final int friendUserId, final int status) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "friend/updateReq/" + friendUserId + "/" + status);
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Gets friendsUserIds and social accounts.
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String getFriends(final String key1, final String key2) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "friend/friends");
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Sets default permission - 1 for private, 2 for public.
////     *
////     * @param permission
////     * @return
////     * @throws Exception
////     */
////    public static String setDefaultPermission(final String key1, final String key2, final int permission) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "permission/setPermission/" + permission);
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Adds permission.
////     *
////     * @param key1
////     * @param key2
////     * @param objectId
////     * @param objectTypeName
////     * @param allow
////     * @return
////     * @throws Exception
////     */
////    public static String addPermission(final String key1, final String key2, final Integer objectId, final String objectTypeName, final Boolean allow) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "permission/addPermission/");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("objectId", objectId.toString()));
////        postParams.add(new BasicNameValuePair("objectTypeName", objectTypeName));
////        postParams.add(new BasicNameValuePair("allow", allow.toString()));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Deletes permission by specified user_id, objectId and objectTypeId.
////     *
////     * @param objectId
////     * @param objectTypeName
////     * @return
////     * @throws Exception
////     */
////    public static String deletePermission(final String key1, final String key2, final int objectId, final String objectTypeName) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "permission/deletePermission/" + objectId + "/" + URLEncoder.encode(objectTypeName, "UTF-8"));
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Sends message.
////     *
////     * @param key1
////     * @param key2
////     * @param destIds
////     * @param content
////     * @param latitude
////     * @param longitude
////     * @return
////     * @throws Exception
////     */
////    public static String sendMessage(final String key1, final String key2, final String destIds, final String content, final String latitude, final String longitude) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "message/sendMess/");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("destIds", destIds));
////        postParams.add(new BasicNameValuePair("content", content));
////        postParams.add(new BasicNameValuePair("latitude", latitude));
////        postParams.add(new BasicNameValuePair("longitude", longitude));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Gets messages with page value.
////     *
////     * @param page
////     * @return
////     * @throws Exception
////     */
////    public static String getMessages(final String key1, final String key2, final int page) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "message/messages/" + page);
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Gets messages.
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String getMessages(final String key1, final String key2) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "message/messages/1");
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Set message read.
////     *
////     * @param key1 user key1
////     * @param key2 user key2
////     * @param messageId Message ID which should be marked as read.
////     * @return String response
////     * @throws Exception when something wrong with server
////     */
////    public static String setMessageRead(final String key1, final String key2, final String messageId) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "message/setRead/" + messageId);
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Gets unread messages.
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String getUnreadMessages(final String key1, final String key2) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "message/unreadMessages" );
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Gets messages count.
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String getMessagesCount(final String key1, final String key2) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "message/getCount" );
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Gets unread messages count.
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String getUnreadMessagesCount(final String key1, final String key2) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "message/getUnreadCount" );
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Deletes message by specified IDs.
////     *
////     * @param messageIds
////     * @return
////     * @throws Exception
////     */
////    public static String deleteMessages(final String key1, final String key2, final String messageIds) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "message/delete");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("messageIds", messageIds));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Sets time zone.
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String setTimeZone(final String key1, final String key2, final String timeZone) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "user/setTimeZone/" + URLEncoder.encode(timeZone, "UTF-8"));
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Set android version.
////     *
////     * @param key1
////     * @param key2
////     * @return
////     * @throws Exception
////     */
////    public static String setAndroidVersion(final String key1, final String key2, final String androidVersion) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "user/setAndroidVersion/" + URLEncoder.encode(androidVersion, "UTF-8"));
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * get android version
////     *
////     *
////     * @param key1
////     * @param key2
////     * @return
////     * @throws Exception
////     */
////    public static String getAndroidVersion(String key1, String key2) throws Exception {
////        if (serviceURL == null) return notInitialized();
////        final HttpGet get = new HttpGet(serviceURL + "user/getAndroidVersion");
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Creates meeting.
////     *
////     * @param title
////     * @param description
////     * @param userIds
////     * @param latitude
////     * @param longitude
////     * @param sendMessage
////     * @return
////     * @throws Exception
////     */
////    public static String createMeeting(final String key1, final String key2, final String title, final String description, final String userIds, final Double latitude, final Double longitude, final Boolean sendMessage) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "meeting/createMeeting/");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("title", title));
////        postParams.add(new BasicNameValuePair("description", description));
////        postParams.add(new BasicNameValuePair("userIds", userIds));
////        postParams.add(new BasicNameValuePair("latitude", latitude.toString()));
////        postParams.add(new BasicNameValuePair("longitude", longitude.toString()));
////        postParams.add(new BasicNameValuePair("sendMessage", sendMessage.toString()));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Meeting confirmation.
////     *
////     * @param meetingId
////     * @param status
////     * @return
////     * @throws Exception
////     */
////    public static String confirmMeeting(final String key1, final String key2, final int meetingId, final int status) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "meeting/confirm/" + meetingId + "/" + status);
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Gets friends from given group.
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String getGroupFriends(final String key1, final String key2, final int groupId) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "group/friends/" + groupId);
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Uploads user profile image.
////     *
////     * @param profileImage
////     * @return
////     * @throws Exception
////     */
////    public static String uploadProfileImage(final String key1, final String key2, final File profileImage) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "user/profile/image");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////        post.setHeader("fileName", profileImage.getName());
////
////        FileInputStream fis = new FileInputStream(profileImage);
////        ByteArrayOutputStream bos = new ByteArrayOutputStream();
////        byte[] buf = new byte[1024];
////        try {
////            for (int readNum; (readNum = fis.read(buf)) != -1;) {
////                bos.write(buf, 0, readNum);
////            }
////        } catch (Exception e) {
////            e.printStackTrace();
////        }
////        byte[] image = bos.toByteArray();
////        ByteArrayEntity b = new ByteArrayEntity(image);
////        post.setEntity(b);
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Gets notifications with page value.
////     *
////     * @param page
////     * @return
////     * @throws Exception
////     */
////    public static String getNotifications(final String key1, final String key2, final int page) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "notification/notifications/" + page);
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Deletes notification by specified ID.
////     *
////     * @param notificationId
////     * @return
////     * @throws Exception
////     */
////    public static String deleteNotification(final String key1, final String key2, final String notificationId) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "/notification/delete/" + notificationId);
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("notificationId", notificationId));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Gets notifications.
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String getNotifications(final String key1, final String key2) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "notification/notifications/1");
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Gets notification types.
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String getNotificationTypes(final String key1, final String key2) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "notification/getNotificationTypes");
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Gets notifications count.
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String getNotificationsCount(final String key1, final String key2) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "notification/getCount" );
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Gets unread notifications count.
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String getUnreadNotificationsCount(final String key1, final String key2) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "notification/getUnreadCount" );
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Sends notification.
////     *
////     * @param toUserId
////     * @param text
////     * @param type
////     * @return
////     * @throws Exception
////     */
////    public static String sendNotification(final String key1, final String key2, final Integer toUserId, final String text, final Integer type, final Integer objectId, final Integer objectTypeId) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "notification/send");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("toUserId", toUserId.toString()));
////        postParams.add(new BasicNameValuePair("content", text));
////        postParams.add(new BasicNameValuePair("type", type.toString()));
////        postParams.add(new BasicNameValuePair("objectId", ""+objectId));
////        postParams.add(new BasicNameValuePair("objectTypeId", ""+objectTypeId));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Changes password.
////     *
////     * @param oldPassword
////     * @param newPassword
////     * @return
////     * @throws Exception
////     */
////    public static String changePassword(final String key1, final String key2, final String oldPassword, final String newPassword) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "user/changePass");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("oldPassword", oldPassword));
////        postParams.add(new BasicNameValuePair("newPassword", newPassword));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Generates a new password in case user forgot the password.
////     *
////     * @param phoneNumber
////     * @return
////     * @throws Exception
////     */
////    public static String forgotPassword(final String phoneNumber) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "forgotPass/" + phoneNumber);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Gets user id, social accounts and last location date.
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String getUserInfo(final String key1, final String key2) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "user/info");
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Gets user groups by socialUid.
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String getGroupsBySuid(final String key1, final String key2, final String socialUid, final String socialNetwork) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "group/groupsBySuid/" + socialUid + "/" + socialNetwork);
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Deletes profile image by specified social_uid.
////     *
////     * @param key1
////     * @param key2
////     * @return
////     * @throws Exception
////     */
////    public static String deleteProfileImage(final String key1, final String key2) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "user/delete");
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Deletes key1 and key2.
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String logout(final String key1, final String key2) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "/logout");
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Adds crash report to Db4oHelper.
////     *
////     * @param report
////     *
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String addCrashReport(final String key1, final String key2, String report) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post;
////        if(key1 == null || key2 == null) {
////            post = new HttpPost(serviceURL + "crashReport");
////        } else {
////            post = new HttpPost(serviceURL + "/user/crashReport");
////            post.setHeader(WAY_KEY1, key1);
////            post.setHeader(WAY_KEY2, key2);
////        }
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("report", report));
////
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Gets user crash report by id.
////     *
////     * @param reportId
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String getCrashReport(final String key1, final String key2, final String reportId) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "/user/crashReport/" + reportId);
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
//////        /**
//////		 * Gets public crash report by id.
//////		 *
//////		 * @return
//////		 * @throws Exception
//////		 */
//////		public static String getPublicCrashReport(final String reportId) throws Exception {
//////            if (serviceURL == null) return notInitialized();
//////
//////            final HttpGet get = new HttpGet(serviceURL + "crashReport/" + reportId);
//////
//////			return getResponse(get, 200, true);
//////		}
////
////    /**
////     * Gets crash reports count.
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String getCrashReportCount(String key1, String key2) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "/user/crashReportCount/");
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Gets crash reports info list.
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String getCrashReportInfoList(String key1, String key2, int count, int offset) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "/user/crashReportList/");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("count", String.valueOf(count)));
////        postParams.add(new BasicNameValuePair("offset", String.valueOf(offset)));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Deletes crash report by specified id.
////     *
////     * @param reportId
////     * @return
////     * @throws Exception
////     */
////    public static String deleteReport(String key1, String key2, int reportId) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "/user/deleteCrashReport/" + reportId);
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Gets user location by userId.
////     *
////     * @param friendSUID
////     * @param socialNetwork
////     * @return
////     * @throws Exception
////     */
////    public static String getUserLocation(final String key1, final String key2, final String friendSUID, final String socialNetwork) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "location/userLocation");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("friendSUID", friendSUID));
////        postParams.add(new BasicNameValuePair("socialNetwork", socialNetwork));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Adds exception report to Db4oHelper.
////     *
////     * @param report
////     *
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String addExceptionReport(final String key1, final String key2, final String report) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post;
////        if(key1 == null || key2 == null) {
////            post = new HttpPost(serviceURL + "exceptionReport");
////        } else {
////            post = new HttpPost(serviceURL + "/user/exceptionReport");
////            post.setHeader(WAY_KEY1, key1);
////            post.setHeader(WAY_KEY2, key2);
////        }
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("report", report));
////
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Unfriend request.
////     *
////     * @param friendUserId
////     * @param beyondFriend
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String unfriend(final String key1, final String key2, final int friendUserId, final int beyondFriend) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "/friend/unfriend");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("friendUserId", String.valueOf(friendUserId)));
////        postParams.add(new BasicNameValuePair("beyondFriend", String.valueOf(beyondFriend)));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * GetAndroidAppVersion request.
////     *
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String getAndroidLastReleaseVersion() throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "/androidAppVersion");
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Gets users which are near me then radius.
////     *
////     * @param radius
////     * @return
////     * @throws Exception
////     */
////    public static String getUsersNearMe(final String key1, final String key2, final double radius) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "user/usersNearMe");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("radius", String.valueOf(radius)));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Clear obsolete locations.
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String clearObsoleteLocations(final String key1, final String key2) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "user/clearObsoleteLocations");
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Sets android app version.
////     *
////     * @param key1
////     * @param key2
////     * @return
////     * @throws Exception
////     */
////    public static String setAndroidAppVersion(final String key1, final String key2, final String androidAppVersion) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpGet get = new HttpGet(serviceURL + "user/setAndroidAppVersion/" + URLEncoder.encode(androidAppVersion, "UTF-8"));
////        get.setHeader(WAY_KEY1, key1);
////        get.setHeader(WAY_KEY2, key2);
////
////        return getResponse(get, 200, true);
////    }
////
////    /**
////     * Sets android app version.
////     *
////     *
////     * @param phoneNumber
////     * @param isValid
////     *
////     * @return
////     * @throws Exception
////     */
////    public static String setPhoneNumberStatus(final String phoneNumber, final boolean isValid) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "setPhoneNumberStatus");
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("phone_number", String.valueOf(phoneNumber)));
////        postParams.add(new BasicNameValuePair("is_valid", String.valueOf(isValid)));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Disable social account.
////     *
////     *
////     * @param key1
////     * @param key2
////     * @param socialNetwork
////     * @param socId
////     * @return
////     * @throws Exception
////     */
////    public static String disableSocAccount(final String key1, final String key2, final String socialNetwork, final String socId) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "user/disableSocialAccount");
////        post.setHeader(WAY_KEY1, key1);
////        post.setHeader(WAY_KEY2, key2);
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("socialNetwork", socialNetwork));
////        postParams.add(new BasicNameValuePair("socUId", socId));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
////
////    /**
////     * Adds social account.
////     *
////     * @param socialNetwork
////     * @param socialUid
////     * @param profileImageUrl
////     * @param firstName
////     * @param lastName
////     * @param email
////     * @param screenName
////     * @param atoken
////     * @param asecret
////     * @return
////     * @throws Exception
////     */
////    public static String loginBySocialNetwork(final String socialNetwork, final String socialUid,
////                                              final String profileImageUrl, final String firstName, final String lastName, final String email,
////                                              final String screenName, final String atoken, final String asecret) throws Exception {
////        if (serviceURL == null) return notInitialized();
////
////        final HttpPost post = new HttpPost(serviceURL + "/addSocAccountByNetwork/");
////
////        final List<NameValuePair> postParams = new ArrayList<NameValuePair>();
////        postParams.add(new BasicNameValuePair("socialNetwork", socialNetwork));
////        postParams.add(new BasicNameValuePair("socialUid", socialUid));
////        postParams.add(new BasicNameValuePair("profileImageUrl", profileImageUrl));
////        postParams.add(new BasicNameValuePair("firstName", firstName));
////        postParams.add(new BasicNameValuePair("lastName", lastName));
////        postParams.add(new BasicNameValuePair("email", email));
////        postParams.add(new BasicNameValuePair("screenName", screenName));
////        postParams.add(new BasicNameValuePair("atoken", atoken));
////        postParams.add(new BasicNameValuePair("asecret", asecret));
////        post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
////
////        return getResponse(post, 200, true);
////    }
//
//
//}
//
//
